var app = getApp();

Page({
    data: {
        systemInfo: {},
        padBtm: "25",
        adviseContent:""
    },
    onLoad: function () {
        var that = this;
        wx.getSystemInfo({
            success: function (res) {
                if (res.model == "iPhone X") {
                    that.setData({
                        padBtm: "50",
                    })
                }
            }
        });
        that.setData({
            navH: app.globalData.navHeight
        })
    },
    navBack: function () {
        wx.navigateBack({
            delta: 1
        })
    },
    bindTextAreaBlur: function (e) {
        this.setData({
            adviseContent: e.detail.value,
        })
    },
    formAdvise: function (e) {
        var that = this;
        wx.request({
            url: app.globalData.apiHost + "/api/suggest/suggestSave",
            data: {
                content: that.data.adviseContent
            },
            header: {
                'content-type': 'application/x-www-form-urlencoded',
                'Cookie': 'token=' + wx.getStorageSync('token')
            },
            method: "POST",
            dataType: "json",
            success: function (res) {
                if (res.statusCode === 200) {
                    if(res.data.code==0){
                        wx.showToast({
                            title: "请填写反馈内容",
                            icon: 'none',
                            duration: 1500
                        })
                    }else if(res.data.code==1){
                        wx.showToast({
                            title: "提交反馈成功",
                            icon: 'none',
                            duration: 1500
                        })
                    }
                    
                }
            },
            
        });
    }
})
